// 静态文件的绝对路径
var $STATIC_PREFIX = '/static';
// 转换安全的数字
$.intval = function (val) {
    return isNaN(parseInt(val)) ? 0 : parseInt(val);
};

// 数组的扩展
// 删除数组项
Array.prototype.remove = function(from, to) {
    var rest = this.slice((to || from) + 1 || this.length);
    this.length = from < 0 ? this.length + from : from;
    return this.push.apply(this, rest);
};
if (!Array.prototype.indexOf) {
    Array.prototype.indexOf = function(item, i) {
        i || (i = 0);
        var length = this.length;
        if (i < 0) 
            i = length + i;
        for (; i < length; i++)
            if (this === item) 
                return i;
        return -1;
    };
}
// 从数组中移除指定项
Array.prototype.removeBy = function(val) {
    var index = this.indexOf(val);
    if (index > -1) {
        this.remove(index);
    }
};
// 添加数组中，若数组中有重复项则不添加
Array.prototype.pushWithoutDuplicate = function(val) {
    if (this.indexOf(val) == -1) {
        this.push(val);
    }
};
/******************************
 * $.query
 * */
new function(settings) { 
  // Various Settings
  var $separator = settings.separator || '&';
  var $spaces = settings.spaces === false ? false : true;
  var $suffix = settings.suffix === false ? '' : '[]';
  var $prefix = settings.prefix === false ? false : true;
  var $hash = $prefix ? settings.hash === true ? "#" : "?" : "";
  var $numbers = settings.numbers === false ? false : true;
  
  jQuery.query = new function() {
    var is = function(o, t) {
      return o != undefined && o !== null && (!!t ? o.constructor == t : true);
    };
    var parse = function(path) {
      var m, rx = /\[([^[]*)\]/g, match = /^([^[]+)(\[.*\])?$/.exec(path), base = match[1], tokens = [];
      while (m = rx.exec(match[2])) tokens.push(m[1]);
      return [base, tokens];
    };
    var set = function(target, tokens, value) {
      var o, token = tokens.shift();
      if (typeof target != 'object') target = null;
      if (token === "") {
        if (!target) target = [];
        if (is(target, Array)) {
          target.push(tokens.length == 0 ? value : set(null, tokens.slice(0), value));
        } else if (is(target, Object)) {
          var i = 0;
          while (target[i++] != null);
          target[--i] = tokens.length == 0 ? value : set(target[i], tokens.slice(0), value);
        } else {
          target = [];
          target.push(tokens.length == 0 ? value : set(null, tokens.slice(0), value));
        }
      } else if (token && token.match(/^\s*[0-9]+\s*$/)) {
        var index = parseInt(token, 10);
        if (!target) target = [];
        target[index] = tokens.length == 0 ? value : set(target[index], tokens.slice(0), value);
      } else if (token) {
        var index = token.replace(/^\s*|\s*$/g, "");
        if (!target) target = {};
        if (is(target, Array)) {
          var temp = {};
          for (var i = 0; i < target.length; ++i) {
            temp[i] = target[i];
          }
          target = temp;
        }
        target[index] = tokens.length == 0 ? value : set(target[index], tokens.slice(0), value);
      } else {
        return value;
      }
      return target;
    };
    
    var queryObject = function(a) {
      var self = this;
      self.keys = {};
      
      if (a.queryObject) {
        jQuery.each(a.get(), function(key, val) {
          self.SET(key, val);
        });
      } else {
        jQuery.each(arguments, function() {
          var q = "" + this;
          q = q.replace(/^[?#]/,''); // remove any leading ? || #
          q = q.replace(/[;&]$/,''); // remove any trailing & || ;
          if ($spaces) q = q.replace(/[+]/g,' '); // replace +'s with spaces
          
          jQuery.each(q.split(/[&;]/), function(){
            var key = decodeURIComponent(this.split('=')[0] || "");
            var val = decodeURIComponent(this.split('=')[1] || "");
            
            if (!key) return;
            
            if ($numbers) {
              if (/^[+-]?[0-9]+\.[0-9]*$/.test(val)) // simple float regex
                val = parseFloat(val);
              else if (/^[+-]?[0-9]+$/.test(val)) // simple int regex
                val = parseInt(val, 10);
            }
            
            val = (!val && val !== 0) ? true : val;
            
            if (val !== false && val !== true && typeof val != 'number')
              val = val;
            
            self.SET(key, val);
          });
        });
      }
      return self;
    };
    
    queryObject.prototype = {
      queryObject: true,
      has: function(key, type) {
        var value = this.get(key);
        return is(value, type);
      },
      GET: function(key) {
        if (!is(key)) return this.keys;
        var parsed = parse(key), base = parsed[0], tokens = parsed[1];
        var target = this.keys[base];
        while (target != null && tokens.length != 0) {
          target = target[tokens.shift()];
        }
        return typeof target == 'number' ? target : target || "";
      },
      get: function(key) {
        var target = this.GET(key);
        if (is(target, Object))
          return jQuery.extend(true, {}, target);
        else if (is(target, Array))
          return target.slice(0);
        return target;
      },
      SET: function(key, val) {
        var value = !is(val) ? null : val;
        var parsed = parse(key), base = parsed[0], tokens = parsed[1];
        var target = this.keys[base];
        this.keys[base] = set(target, tokens.slice(0), value);
        return this;
      },
      set: function(key, val) {
        return this.copy().SET(key, val);
      },
      REMOVE: function(key) {
        return this.SET(key, null).COMPACT();
      },
      remove: function(key) {
        return this.copy().REMOVE(key);
      },
      EMPTY: function() {
        var self = this;
        jQuery.each(self.keys, function(key, value) {
          delete self.keys[key];
        });
        return self;
      },
      load: function(url) {
        var hash = url.replace(/^.*?[#](.+?)(?:\?.+)?$/, "$1");
        var search = url.replace(/^.*?[?](.+?)(?:#.+)?$/, "$1");
        return new queryObject(url.length == search.length ? '' : search, url.length == hash.length ? '' : hash);
      },
      empty: function() {
        return this.copy().EMPTY();
      },
      copy: function() {
        return new queryObject(this);
      },
      COMPACT: function() {
        function build(orig) {
          var obj = typeof orig == "object" ? is(orig, Array) ? [] : {} : orig;
          if (typeof orig == 'object') {
            function add(o, key, value) {
              if (is(o, Array))
                o.push(value);
              else
                o[key] = value;
            }
            jQuery.each(orig, function(key, value) {
              if (!is(value)) return true;
              add(obj, key, build(value));
            });
          }
          return obj;
        }
        this.keys = build(this.keys);
        return this;
      },
      compact: function() {
        return this.copy().COMPACT();
      },
      toString: function() {
        var i = 0, queryString = [], chunks = [], self = this;
        var encode = function(str) {
          str = str + "";
          if ($spaces) str = str.replace(/ /g, "+");
          return encodeURIComponent(str);
        };
        var addFields = function(arr, key, value) {
          if (!is(value) || value === false) return;
          var o = [encode(key)];
          if (value !== true) {
            o.push("=");
            o.push(encode(value));
          }
          arr.push(o.join(""));
        };
        var build = function(obj, base) {
          var newKey = function(key) {
            return !base || base == "" ? [key].join("") : [base, "[", key, "]"].join("");
          };
          jQuery.each(obj, function(key, value) {
            if (typeof value == 'object') 
              build(value, newKey(key));
            else
              addFields(chunks, newKey(key), value);
          });
        };
        
        build(this.keys);
        
        if (chunks.length > 0) queryString.push($hash);
        queryString.push(chunks.join($separator));
        
        return queryString.join("");
      }
    };
    
    return new queryObject(location.search, location.hash);
  };
}(jQuery.query || {});
/************************************
 * 添加收藏
 * */
$.fav = function (url, title) {
    try {
        window.external.addFavorite(url, title);
    } catch (e) {
        try {
            window.sidebar.addPanel(title, url, '');
        } catch (e) {
            alert('请使用 Ctrl + D 将寻宝图添加到收藏夹中！');
        }
    }
};

/*********************************
 * @author: Tianzhen(uimeet.com)
 *
 * 扩展attrs方法，jquery默认的attr，
 * 在选择器包含多个对象时，只返回第一个元素的属性，
 * 本方法返回所有
 */
$.fn.attrs = function(attr) {
    var atrs = [];
    this.each(function () {
        atrs.push($(this).attr(attr));
    });
    return atrs;
};
// 获取core.js的绝对路径
$.abspath = function () {
    var path = '';
    $.each($('script').attrs('src'), function (index, value) {
        var pos = value.lastIndexOf('/core.js');
        if (pos > -1) {
            path = value.substr(0, pos - '/scripts'.length);
            return path;
        }
    });
    return path;
};
(function ($) {
    $STATIC_PREFIX = $.abspath();
})($);
/****************************************
 * @author tony
 * @url http://archive.plugins.jquery.com/project/URLEncode
 * 兼容性url编码解码
 */
$.extend({URLEncode:function(c){var o='';var x=0;c=c.toString();var r=/(^[a-zA-Z0-9_.]*)/;
  while(x<c.length){var m=r.exec(c.substr(x));
    if(m!=null && m.length>1 && m[1]!=''){o+=m[1];x+=m[1].length;
    }else{if(c[x]==' ')o+='+';else{var d=c.charCodeAt(x);var h=d.toString(16);
    o+='%'+(h.length<2?'0':'')+h.toUpperCase();}x++;}}return o;},
URLDecode:function(s){var o=s;var binVal,t;var r=/(%[^%]{2})/;
  while((m=r.exec(o))!=null && m.length>1 && m[1]!=''){b=parseInt(m[1].substr(1),16);
  t=String.fromCharCode(b);o=o.replace(m[1],t);}return o;}
});

/*********************************
 * @author: Tianzhen(uimeet.com)
 *
 * 在js文件中来包含该js文件支持的文件
 * 让head代码更简洁
 * */
function include(files) {
    files = typeof(files) == 'string' ? [files] : files;
    // 这里所有已加载的css和js文件
    var scripts = $('script').attrs('src'),
        css = $('link').attrs('href');
    $.each(files, function (index, file){
        var data = file.replace(/^\s|\s$/g, '');
        var m;
        if (/\.\w+$/.test(data)) {
            m = data.match(/([^\/\\]+)\.(\w+)$/);
            if (m) {
                if (file.substring(0,4) != 'http') {
                    file = $STATIC_PREFIX + file;
                }
                if (m[2] == 'js') {
                    // 是否已经包含在js文件中
                    if ($.inArray(file, scripts) == -1) {
                        document.write('<script type="text/javascript" src="' + file + '" charset="utf-8"></script>');
                    } 
                } else if (m[2] == 'css') {
                    // 是否包含在css文件中
                    if ($.inArray(file, css) == -1) {
                        document.write('<link rel="stylesheet" type="text/css" href="' + file + '" charset="utf-8" />');
                    }
                }
            }
        }
    });
};

/*********************************
 * @author: Tianzhen(uimeet.com)
 *
 * 执行指定命令
 * @command as String, 命令名称
 * @args as Object, 参数列表
 * @method as String, 执行命令的方式，POST or GET
 * @callback as Function, 执行成功后的回调函数
 * */
function execute(command, args, callback, method) {
    if (command) {
        // 方法默认为 POST
        method = method || 'POST';
        // 回调函数默认为空函数
        callback = callback || new Function();
        // 获取对应的执行方法
        var handle = method == 'GET' ? $.get : $.post;
        // go..
        handle('/async-cmd/' + command, args, callback, 'html');
    }
}

include(['/scripts/libs/fancybox/jquery.fancybox-1.3.4.css',
        '/scripts/libs/fancybox/jquery.fancybox-1.3.4.pack.js']);
/***************************************************
 * @author: Tianzhen(uimeet.com)
 *
 * 对需要登录限制的连接，进行客户端验证
 * 登录状态无效时，弹出登录框，提升体验
 * usage:
 *      在需要登录状态才能点击的标签上，
 *      加入一个名为login的class样式。
 *
 *      如：<a href="/xxx/xxx" class="_login"></a>
 *
 *      $('._login').login();
 * */
(function ($) {
    
    var instances = [], rawInstances = [];
    var layer = $('<a class="hide" id="loginhandle" href="/login?mode=lite"></a>');
    
    // 登录对象
    function Login(rawTrigger, conf) {
        var self = this,
            // 获取触发对象
            trigger = $(rawTrigger),
            // 超链接事件托管
            href = trigger.attr('href') || '',
            // 控件的单击事件托管
            click = trigger.attr('onclick'),
            submit = null,
            // 是否是form标签
            isForm = trigger.attr('tagName') == 'FORM',
            // 是否是input标签，对于input标签要特殊处理
            // 当input是.NET服务端控件时
            isInput = trigger.attr('tagName') == 'INPUT',
            // 获取事件
            evtName = isForm ? 'submit' : 'click',
            // 提取绑定事件
            bind = resloveBindEvents(rawTrigger, evtName);
            // 清除并托管事件
            if (href) {
                trigger.attr('href', 'javascript:;');
            }
            if (click) {
                trigger.attr('onclick', 'return false;');
            }
            if (isInput) {
                trigger.bind('click', empty);
            }
            if (isForm) {
                trigger.submit(function () {
                    alert('submit');
                    // self.load(e);
                    return false;
                });
            } else {
                trigger.click(function (e) {
                    self.load(e);
                });
            }

            $.extend(self, {
                // 触发原始事件
                fireRawEvents: function () {
                    if (isInput) {
                        // 如果是input控件需要特殊处理
                        trigger.unbind('click');
                    } else if (isForm) {
                        trigger.unbind('submit');
                    }
                    if (click) {
                        click();
                    } else if (href) {
                        if (href.indexOf('javascript:') > -1) {
                            eval(href);
                        } else {
                            location.href = href;
                        }
                    } else if (isInput) {
                        trigger.trigger('click');
                    } else {
                        trigger.trigger('submit');
                    }
                    if (bind) {
                        // 托管的绑定有效
                        for (var i in bind) {
                            if (bind[i].handler)
                                bind[i].handler(bind[i]);
                        }
                    }
                },
                load: function (e) {
                    execute('login', {}, function (response) {
                        if (response == '1') {
                            // 已登录
                            // 触发原始事件
                            self.fireRawEvents();
                        } else {
                            var url = href;
                            if (url.substring(0, 'javascript:'.length) == 'javascript:') {
                                url = top.location.href;
                            } else if (url.substring(0, 1) == '#') {
                                url = top.location.href + url;
                            }
                            // 未登录
                            // 弹出登录框
                            layer.load(url);
                        }
                    });
                }
            });
    };

    // 提取对象中绑定的事件
    // @elem 必须是原始的DOM对象
    function resloveBindEvents(elem, evt) {
        evt = evt || 'click';
        var elemData = jQuery._data(elem);
        // 只处理绑定的click事件
        if (elemData && elemData.events && elemData.events[evt]) {
            var handlers = [];
            var events = elemData.events[evt];
            if (events && events.length > 0) {
                for (var index in events) {
                    //handlers.push(events[index].handler);
                    handlers.push(events[index]);
                }
                // 移除事件绑定，由本对象托管
                $(elem).unbind(evt);
                // 返回托管的函数
                return handlers;
            }
        }
        return false;
    };

    // 表示一个空处理
    function empty() {
        return false;
    };

    // 一些初始化操作
    function __init__() {
        init_dialog();
    };

    // 初始化弹窗
    function init_dialog() {
        if ($('#loginhandle').data('init')) {
            return;
        }

        $(document.body).append(layer);
        // 设置fancybox
        layer.fancybox({
            'margin': 0,
            'padding': 0,
            'showCloseButton': false
        });
        layer.extend({
            load: function(url) {
                url = this.attr('href') + '&url=' + $.URLEncode(url);
                this.attr('href', url);
                this.trigger('click');
            }
        });
        layer.data('init', true);
    };

    $.fn.login = function (conf) {
        // 初始化
        __init__();

        this.each(function () {
            var self = $(this);

            // 实例化Login对象
            el = new Login(this, conf);
            // 缓存实例
            self.data('login', el);
            // 添加到实例集合
            instances.push(el);
            rawInstances.push(this);
        });

        return this;
    };
    
})(jQuery);

$.login = function (url) {
    $('<a></a>').attr('href', url || top.location.href)
        .login()
        .trigger('click');
};


(function ($) {

    var options = {
        'template': {
            'logined': '<a href="javascript:;">{name}</a>&nbsp;&nbsp;<a href="/logout">[退出]</a>',
            'login': '<span class="gray middle fl">使用已有帐号登录：</span><a href="/login?mode=lite&url='+$.URLEncode($.query.get('from', undefined) || top.location.href)+'" onclick="_gaq.push([\'_trackPageview\', \'/_trc/login\']);" class="email_ico" title="使用邮箱登录"></a><a href="/connect/sina?url='+$.URLEncode($.query.get('from', undefined) || top.location.href)+'" onclick="_gaq.push([\'_trackPageview\', \'/_trc/connect/sina\']);" class="sina_ico" title="使用新浪微博登录"></a><a href="/connect/tencent?url='+$.URLEncode($.query.get('from', undefined) || top.location.href)+'" onclick="_gaq.push([\'_trackPageview\', \'/_trc/connect/tencent\']);" class="tencent_ico" title="使用腾讯微博登录"></a>'
        }
    };
    function SignInView(rawTriggers, conf) {
        var self = this;
        
        $.extend(options, conf);

        $.extend(self, {
            load: function () {
                // 判断是否登录
                execute('login'
                    , {'include_info': 1}
                    , function (response) {
                        if (response == '0') {
                            // 未登录
                            self.login_view();
                        } else {
                            // 已登录
                            self.logined_view(response);
                        }
                    });
            },
            login_view: function() {
                rawTriggers.html(options.template.login);
                $.dialog('.email_ico', {'height':97, 'titleShow':false});
            },
            logined_view: function(response) {
                var info = $.parseJSON(response);
                if (info) {
                    var view = options.template.logined.replace('{name}'
                        , info.name);
                }
                rawTriggers.html(view);
            }
        });

        self.load();

    };
    
    $.fn.signin_view = function(conf) {
        
        conf = conf || {};
        new SignInView(this, conf);

    };

})(jQuery);


/*************************************
 * @author Tianzhen(uimeet.com)
 *
 * 根据分值显示星星
 * */
(function ($) {

    function RatingStar(rawTrigger, conf) {
        var self = this,
            trigger = $(rawTrigger),
            // 实际得分
            rating = parseFloat(trigger.attr('rating')),
            // 每颗星的分数
            ratio = parseInt(trigger.attr('ratio')),
            // 星的总数
            length = 5;
        
        var options = $.extend({
                'text':'<div class="fl">性价比指数：</div>',
                'showText': true
        }, conf);
        $.extend(options, 
            {'showText': trigger.attr('text') == 'true' || trigger.attr('text') == undefined});

        // 实际得分必须在0-10分以内
        rating = isNaN(rating) ? 0 : Math.min(rating, 10);
        // 每颗星的分数
        ratio = isNaN(ratio) ? 2 : Math.max(ratio, 1);

        $.extend(self, {
            load: function () {
                self.buildInterface();
                self.buildRating();
            },
            calc_stars: function () {
                // 计算分值按照星数折算后的数量
                var stars = rating / ratio;
                var floor = Math.floor(stars);
                return [floor, stars - floor];
            },
            buildRating: function () {
                var stars = trigger.find('div.star');
                var vals = self.calc_stars();
                
                trigger.find('div.star:lt(' + vals[0] + ')').addClass('on');
                if (percent = vals[1] ? vals[1] * 100 : null) {
                    stars.eq(vals[0]).addClass('on').children('a').css('width', percent + '%');
                }

            },
            buildInterface: function () {
                if (options.showText) {
                    trigger.append(options.text);
                }
                for (var i = 0; i < length; i++) {
                    trigger.append('<div class="star"><a href="javascript:;">' + i + '</a></div>');
                }
                trigger.append('<div class="fl ml_5">'+rating+'</div>');
                trigger.attr('title', '性价比指数，是由寻宝图的专业旅游编辑们投票所得平均分数，基于品质标准、价格比较、口碑评论以及供应商诚信等因素综合打分。');
            }
        });

        self.load();
        
    };
    
    $.fn.stars = function (conf) {

        conf = conf || {};
        
        this.each(function () {
            
            new RatingStar(this, conf);

        });

    };

})(jQuery);

(function ($) {
    
    $.fn.value_opr = function (conf) {

        var self = this;

        $('form').submit(function () {
            self.each(function () {
                var the = $(this);
                if (the.val() == the.attr('init-value')) {
                    the.val('');
                }
            });
            return true;
        });

        this.each(function () {
            var the = $(this);
            var init_value = the.attr('init-value');
            the.focus(function () {
                if (the.val() == init_value) {
                    the.removeClass('gray').val('');
                }
            });
            the.blur(function () {
                if (the.val() == '') {
                    the.addClass('gray').val(init_value);
                }
            });
            the.addClass('gray').val(init_value);

        });

        return this;

    };

})(jQuery);

// 简化弹出操作
$.dialog = function(selector, conf) {
    var options = $.extend({
                'showCloseButton': false,
                'margin': 0,
                'padding': 0
            }, conf);
    $(selector).fancybox(options);
};
$.iframeDialog = function(selector, conf) {
    var options = $.extend({
            'type': 'iframe',
            'width': 363,
            'height': 'auto'
        }, conf);
    $.dialog(selector, options);
};

//include(['/scripts/libs/powerfloat/powerFloat.css','/scripts/libs/powerfloat/jquery-powerFloat-min.js']);
// 关注寻宝图的浮动层
/*
$.followsite = function (selector, evtType) {
    $(selector).powerFloat({
        eventType: evtType || 'click',
        target: '/help/followsite',
        targetMode: 'ajax'
    });
};
*/

/****************************
 * 登录表单
 * @author Tianzhen(uimeet.com)
 * */
(function ($) {

    function LoginForm(rawTrigger, conf) {
        var trigger = $(rawTrigger),
            self = this,
            next = trigger.find('[name=url]').val(),
            tip = trigger.find('.login-tip'),
            loading = trigger.find('.loading');
        
        $.extend(self, {
            'load': function () {
                trigger.validator({'message': false})
                                    .submit(self.form_submit);
                trigger.find('.submit').click(self.submit);
            },
            form_submit: function(e) {
                var form = $(this);
                if (!e.isDefaultPrevented() && self.loading()) {
                    // 登录校验
                    execute('check_login', {
                            'email': form.find(':email').val(),
                            'pwd': form.find(':password').val(),
                            'remeber': form.find(':checkbox').attr('checked') == 'checked',
                            'url': next
                        }
                        , function (response) {
                            eval ('var resp = ' + response + ';');
                            if (resp.status == 0) {
                                // 登录成功
                                if (next) {
                                    top.location.href = $.URLDecode(next);
                                } else {
                                    top.location.href = '/';
                                }
                            } else {
                                self.tip(resp.msg);
                            }
                            self.complete();
                        }
                    );
                }
                e.preventDefault();
            },
            submit: function() {
                self.tip();
                trigger.submit();
                return false;
            },
            tip: function (msg) {
                if (msg) {
                    tip.show();
                    tip.html(msg);
                } else {
                    tip.hide();
                }
            },
            loading: function() {
                if (loading.data('loading')) {
                    // 正在处理中
                    return false;
                }
                // 等待处理
                loading.data('loading', true);
                loading.show();
                return true;
            }, 
            complete: function () {
                loading.data('loading', false);
                loading.hide();
            }
        });

        self.load();

    };
    
    $.fn.login_form = function (conf) {

        var self = this;
        var conf = conf || {};
        
        this.each(function () {
            new LoginForm(this, conf);
        });

    };

})(jQuery);

/**********************************************
 * 订阅框弹出层
 * @author Tianzhen(uimeet.com)
 * */
$.subscribe = function(delay) {
    var el = $('<a href="/subscribe?mode=lite&from=' + $.URLEncode(location.href) + '"></a>');
    $.dialog(el, {'hideOnOverlayClick':false});

    var load = function () {
        el.trigger('click');
    };

    if (delay) {
        window.setTimeout(load, delay);
    } else {
        load();
    }
};

/************************************************
 * loading显示
 * @author Tianzhen(uimeet.com)
 * */
(function ($) {

    var element = $('<img class="hide" src="' + $STATIC_PREFIX + '/images/common/loading_blue.gif" />');
    // 初始化操作
    function __init__() {
        if (!element.data('init')) {
            $(document.body).append(element);
            element.data('init', true);
        }
    };

    function Loading(rawTrigger, conf) {
        var self = this,
            trigger = $(rawTrigger),
            parent = trigger.parent();

        // 设置触发对象的父容器为相对定位
        parent.css('position', 'relative');

        // firefox 下设置的top和left位置
        conf = $.extend({
            'moztop': 0,
            'mozleft': 0
        }, conf);

        $.extend(self, {
            'load': function () {
                var offset = trigger.offset();
                // 追加元素
                parent.append(element);
                // 设置进度条定位
                element.css({
                    'position': 'absolute',
                    'z-index': 999999999,
                    // 这里为了处理 firefox 的相对定位问题
                    // 专门做的处理
                    'left': $.browser.mozilla ? conf.mozleft : 0,
                    'top': $.browser.mozilla ? conf.moztop : 0
                });
                element.show();
            }
        });

        // 持有该对象
        trigger.data('loading', self);
    };

    $.fn.loading = function (conf) {

        this.each(function () {
            new Loading(this, conf);

        });

    };

})(jQuery);
